#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main(void)
{
    int n, a, i, j;

    scanf("%d", &n);

    int xstart = n + 1, xend = 0, ystart = n + 1, yend = 0;
    for (i = 1; i <= n; i++)
        for (j = 1; j <= n; j++) {
            scanf("%d", &a);

            if (a == 0) {
                if (i < xstart || j < ystart) {
                    xstart = i;
                    ystart = j;
                }
                if (i > xend || j > yend) {
                    xend = i;
                    yend = j;
                }
            }
        }

    printf("%d\n", (xend - xstart - 1) * (yend - ystart - 1));

    return 0;
}